package com.longteng.diamond.dao;

import com.longteng.diamond.domain.InterfaceTest;
import com.longteng.diamond.domain.Project;
import com.longteng.diamond.domain.ProjectMember;
import com.longteng.diamond.po.RequestResult;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * Created by Administrator
 * DATE : 2018/6/28
 * TIME : 20:23
 * PROJECT : java-lesson
 * PACKAGE : com.longteng.lesson
 *
 * @author <a href="mailto:taki@qq.com">Administrator</a>
 */
@Mapper
public interface ProjectMapper {
    /**
     * 获取接口
     * @param map
     * @return List<Project>
    * */
    public List<Project> getProject(Map map);

    /**
     * 获取项目总行
     * @param map
     * @return long
     * */
    public long  queryAllRow(Map map);
    /**
     * 根据用户id获取项目
     * @param userId
     * @return List<Project>
     * */
    public List<Project> getProjectByUserId(Integer userId);

    /**
     * 根据id获取项目
     * @param projectId
     * @return Project
     * */
    public Project findProjectById(Integer projectId);

    /**
     * 新增项目
     * @param project
     * @return void
     * */
    public void addProject(Project project);
    /**
     * 修改项目
     * @param project
     * @return void
     * */
    public void updateProject(Project project);

    /**
     * 绑定用户与项目关系
     * @param projectMember
     * @return void
     * */
    public void addMember(ProjectMember projectMember);

    /**
     * 删除项目
     * @param projectId
     * @return
     */
    @Delete("update project set yn=0,updateTime=now() where projectId =#{projectId}")
    public void deleteProjectById(@Param("projectId") Integer projectId);
}
